package com.originskyseed.platform.role.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.originskyseed.platform.role.model.Menu;

/**
 * 菜单Mapper类
 * 
 * @author LiangMingHui
 *
 */
public interface MenuMapper {

	/**
	 * deleteByPrimaryKey
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKey(String id) throws Exception;

	/**
	 * deleteByPrimaryKeys
	 * 
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * insert
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insert(Menu record) throws Exception;

	/**
	 * insertSelective
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insertSelective(Menu record) throws Exception;

	/**
	 * selectByPrimaryKey
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Menu selectByPrimaryKey(String id) throws Exception;

	/**
	 * updateByPrimaryKeySelective
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKeySelective(Menu record) throws Exception;

	/**
	 * updateByPrimaryKey
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKey(Menu record) throws Exception;

	/**
	 * 根据code获取子菜单
	 * 
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Menu> selectFirstLevelMenus(Map<String, Object> params) throws Exception;

	/**
	 * 根据code和用户id获取用户拥有权限的子菜单
	 * 
	 * @param code
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public List<Menu> selectFirstLevelMenusByUser(@Param("code") String code, @Param("userId") String userId) throws Exception;

	/**
	 * 获取二级菜单列表
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Menu> selectSecondLevelMenus(Map<String, Object> params) throws Exception;

	/**
	 * 获取全部菜单列表
	 * 
	 * @return
	 * @throws Exception
	 */
	public List<Menu> selectAllMenus(@Param("mallId") String mallId) throws Exception;

	/**
	 * 分页查询菜单列表
	 * 
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Menu> selectListByPage(Map<String, Object> params) throws Exception;

	/**
	 * 查询列表
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<Menu> selectList(Menu record) throws Exception;

	/**
	 * 三级菜单
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	List<Menu> selectThirdLevelMenus(Map<String, Object> params) throws Exception;

	/**
	 * 根据角色code查询一级菜单
	 * 
	 * @param roleCode
	 * @return
	 * @throws Exception
	 */
	List<Menu> selectFirstMenuByRoleCode(@Param("roleCode") String roleCode) throws Exception;

	/**
	 * 根据角色查询菜单
	 * 
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	List<Menu> selectMenuByRoleId(List<String> ids) throws Exception;

	/**
	 * 根据用户标识获取菜单列表
	 *
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public List<Menu> selectByUserId(String userId) throws Exception;

	/**
	 * 查询
	 * 
	 * @param sysType
	 * @return
	 * @throws Exception
	 */
	public String selectParentIdBySysType(@Param("sysType") int sysType) throws Exception;

	/**
	 * selectButtonLevelByCode
	 * 
	 * @param permissionCode
	 * @param roleId
	 * @return
	 * @throws Exception
	 */
	public List<Menu> selectButtonLevelByCode(@Param("permissionCode") String permissionCode, @Param("roleId") String roleId) throws Exception;
}